package indi.jp.project.center.service.impl;

import indi.jp.project.center.entity.Msg;
import indi.jp.project.center.service.MsgService;
import indi.jp.project.core.dao.BaseDao;
import org.springframework.stereotype.Service;

import java.sql.SQLException;

/**
 * 消息服务
 *
 * @author jiangping
 * @date 2022/3/1
 */
@Service
public class MsgServiceImpl implements MsgService {

    private BaseDao baseDao;

    public MsgServiceImpl(BaseDao baseDao) {
        this.baseDao = baseDao;
    }

    @Override
    public int createMsg(Msg msg) throws SQLException {
        return baseDao.insert("centerMsgMapper.insert", msg);
    }

    @Override
    public Msg queryLastOneByTaskId(String taskId) throws SQLException {
        return (Msg) baseDao.findById("centerMsgMapper.queryLastOneByTaskId", taskId);
    }
}
